package com.rickpan.dto.response;

import com.rickpan.entity.FileInfo;
import java.time.LocalDateTime;

/**
 * 文件信息DTO
 * 避免Hibernate懒加载序列化问题
 */
public class FileInfoDTO {
    
    private Long id;
    private String fileName;
    private String originalName;
    private String filePath;
    private Long fileSize;
    private String fileHash;
    private String fileSha256;
    private String mimeType;
    private Long ownerId;
    private Long parentId;
    private Boolean isDirectory;
    private Boolean isDeleted;
    private LocalDateTime deletedAt;
    private Long originalParentId;
    private String thumbnailPath;
    private Integer downloadCount;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    // 构造函数
    public FileInfoDTO() {}
    
    public FileInfoDTO(FileInfo fileInfo) {
        this.id = fileInfo.getId();
        this.fileName = fileInfo.getFileName();
        this.originalName = fileInfo.getOriginalName();
        this.filePath = fileInfo.getFilePath();
        this.fileSize = fileInfo.getFileSize();
        this.fileHash = fileInfo.getFileHash();
        this.fileSha256 = fileInfo.getFileSha256();
        this.mimeType = fileInfo.getMimeType();
        this.ownerId = fileInfo.getOwnerId();
        this.parentId = fileInfo.getParentId();
        this.isDirectory = fileInfo.getIsDirectory();
        this.isDeleted = fileInfo.getIsDeleted();
        this.deletedAt = fileInfo.getDeletedAt();
        this.originalParentId = fileInfo.getOriginalParentId();
        this.thumbnailPath = fileInfo.getThumbnailPath();
        this.downloadCount = fileInfo.getDownloadCount();
        this.createdAt = fileInfo.getCreatedAt();
        this.updatedAt = fileInfo.getUpdatedAt();
    }
    
    // 静态工厂方法
    public static FileInfoDTO from(FileInfo fileInfo) {
        return new FileInfoDTO(fileInfo);
    }
    
    // Getter和Setter方法
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public String getFileName() {
        return fileName;
    }
    
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
    
    public String getOriginalName() {
        return originalName;
    }
    
    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }
    
    public String getFilePath() {
        return filePath;
    }
    
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }
    
    public Long getFileSize() {
        return fileSize;
    }
    
    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }
    
    public String getFileHash() {
        return fileHash;
    }
    
    public void setFileHash(String fileHash) {
        this.fileHash = fileHash;
    }
    
    public String getFileSha256() {
        return fileSha256;
    }
    
    public void setFileSha256(String fileSha256) {
        this.fileSha256 = fileSha256;
    }
    
    public String getMimeType() {
        return mimeType;
    }
    
    public void setMimeType(String mimeType) {
        this.mimeType = mimeType;
    }
    
    public Long getOwnerId() {
        return ownerId;
    }
    
    public void setOwnerId(Long ownerId) {
        this.ownerId = ownerId;
    }
    
    public Long getParentId() {
        return parentId;
    }
    
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    
    public Boolean getIsDirectory() {
        return isDirectory;
    }
    
    public void setIsDirectory(Boolean isDirectory) {
        this.isDirectory = isDirectory;
    }
    
    public Boolean getIsDeleted() {
        return isDeleted;
    }
    
    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    public LocalDateTime getDeletedAt() {
        return deletedAt;
    }

    public void setDeletedAt(LocalDateTime deletedAt) {
        this.deletedAt = deletedAt;
    }

    public Long getOriginalParentId() {
        return originalParentId;
    }

    public void setOriginalParentId(Long originalParentId) {
        this.originalParentId = originalParentId;
    }

    public String getThumbnailPath() {
        return thumbnailPath;
    }
    
    public void setThumbnailPath(String thumbnailPath) {
        this.thumbnailPath = thumbnailPath;
    }
    
    public Integer getDownloadCount() {
        return downloadCount;
    }
    
    public void setDownloadCount(Integer downloadCount) {
        this.downloadCount = downloadCount;
    }
    
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }
    
    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
    
    @Override
    public String toString() {
        return "FileInfoDTO{" +
                "id=" + id +
                ", fileName='" + fileName + '\'' +
                ", originalName='" + originalName + '\'' +
                ", fileSize=" + fileSize +
                ", isDirectory=" + isDirectory +
                '}';
    }
}
